package model.tokens;

import java.util.Deque;
import java.util.Queue;
import java.util.Stack;

import model.parser.ParserException;
import model.semantics.ConstNode;
import model.semantics.Node;

public class ConstantToken extends LiteralToken<Integer> {

    public ConstantToken(TokenConstructorArguments<Integer> args) {
        super(args);
    }

    @Override
    public Node<Integer> makeNewInstance(Deque<Node<Integer>> nodes) {
        int value;
        try {
            value = Integer.parseInt(getLabel());
        } catch (NumberFormatException e) {
            throw ParserException.BAD_TOKEN;
        }
        return new ConstNode<Integer>(value);
    }
}
